<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
		<link rel="stylesheet" type="text/css" href="../../css/reset.css"/>
		<link rel="stylesheet" type="text/css" href="../../css/add.css"/>
	</head>
	<body>
		<div id="app">
			<div class="header">
				<span>添加快递员</span>
			</div>
			<div class="content">
				<table>
					<tr>
						<td class="text-right">姓名</td><td class="content_right"><input class="input" placeholder="请输入姓名"></td>
					</tr>
					<tr>
						<td class="text-right">手机号码</td><td class="content_right"><input id="check_phone" class="input" placeholder="请输入姓名"></td>
					</tr>
					<tr>
						<td class="text-right">身份证号码</td><td class="content_right"><input id="check_idcard" class="input" placeholder="请输入姓名"></td>
					</tr>
					<tr>
						<td class="text-right">密码</td><td class="content_right"><input class="input" placeholder="请输入姓名"></td>
					</tr>
					<tr>
						<td></td><td class="content_right"><span class="btn btn-info" id="check">立即提交</span> <span class="btn" id="remove">重置</span> </td>
					</tr>
				</table>
				
				
			</div>
		</div>
		<script src="../../assets/layui.all.js"></script>
		<script src ="/qrcode/jquery2.1.4.js"></script>
		<script src="/layer/layer.js"></script>

		<script>
			var form = layui.form, layer = layui.layer;
		</script>
		<script>
			//校验手机号
			$("#check_phone").mouseenter(function () {
				$("#check_phone").css({"background": "rgba(234,97,97,0)"})
			});
			$("#check_idcard").mouseenter(function () {
				$("#check_idcard").css({"background": "rgba(234,97,97,0)"})
			});


			$("#check").click(function () {

				var Phone = $("input:eq(1)").val();
				if (Phone.match(/^[0-9_]{11}$/) == null) {

					layer.msg("输入错误，请输入正确的手机号");
					$("#check_phone").css({"background": "rgba(234,97,97,0.3)"});
					return false;
				}
				var IDCard = $("input:eq(2)").val();
				if (IDCard.match(/^[0-9A-Za-z_]{18}$/) == null) {

					layer.msg("输入错误，请输入正确的身份证号");
					$("#check_idcard").css({"background": "rgba(234,97,97,0.3)"});
					return false;
				}

				return true;
			});
		</script>
		<script>

			$(function () {
				$("#check").click(function () {
					var windowId = layer.load();
					var u_name = $("input:eq(0)").val();
					var u_phone = $("input:eq(1)").val();
					var u_idcard = $("input:eq(2)").val();
					var u_password = $("input:eq(3)").val();
					$.post("/user/insert.do",{
						u_name:u_name,
						u_phone:u_phone,
						u_idcard:u_idcard,
						u_password:u_password

					},function (data){
						layer.close(windowId);
						layer.msg(data.result);
						if (data.status == 0){
							$("input").val("");
						}


					});
					return false;

				});

				$("#remove").click(function () {
					$("input").val("");

				})
			});
		</script>
	</body>
</html>
